<extend name="Public/base" />

<block name="body">
    <form method="POST" id="orderlist" action="{:U('Reject/orderExport')}">
        <!-- 标题栏 -->
        <div class="main-title">
            <h2>退货订单管理
                <a href="{:U('Reject/dealWith')}" class="btn   btn-primary">新增订单</a>
                <a onclick="orderexport();" class="btn confirm btn-success">批量导出</a>
            </h2>
        </div>
        
        <div class="navbar navbar-default" style="margin: 0px;">
            <!-- 高级搜索 -->
            <div class="search-form " style="margin-top: 10px;margin-left: 10px;">
                <div class="sleft" style="min-width:80px;">
                    <input type="text" name="b_date" class="text input-large time" value="{:I('b_date')}" placeholder="请选择开始时间"   style="height: 30px;width:150px" />
                </div>
                <div class="sleft" style="min-width: 80px;">
                    <input type="text" name="e_date" class="text input-large time" value="{:I('e_date')}" placeholder="请选择结束时间"   style="height: 30px;width:150px" />
                </div>
                <div class="sleft">
                    <select name="isExport" id="isExport"  style="height: 30px;width:120px">
                        <option value="">所有导出状态</option>
                        <option value="1" {$_isExport=="1"?'selected':''}>已导出</option>
                        <option value="0" {$_isExport=="0"?'selected':''}>未导出</option>
                    </select>
                </div>
                <div class="sleft">
                    <input type="text" name="toName" class="search-input"  value="{:I('toName')}"  placeholder="收货人" style="height: 30px;width:90px">
                </div>
                <div class="sleft">
                    <input type="text" name="toPhone" class="search-input" value="{:I('toPhone')}"  placeholder="联系号码" style="height: 30px;width:100px">
                </div>
                <div class="sleft">
                    <input type="text" name="oid" class="search-input" value="{:I('oid')}"  placeholder="原先订单编号" style="height: 30px;width:150px">
                </div>
                <div class="sleft">
                    <input type="text" name="tdorderid" class="search-input" value="{:I('tdorderid')}"  placeholder="订单编号查询订单" style="height: 30px;width:150px">
                    <a class="sch-btn" href="javascript:;" id="search" url="{:U('')}"><i class="btn-search"></i></a>
                </div>
            </div>
        </div>
       
        <!-- 数据列表 -->
        <div class="data-table table-striped">
            <table class="table table-hover">
                <thead>
                    <tr>
                        <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                        <th>退单编号</th>
                        <th>原先订单编号</th>
                        <th>退单金额</th>
                        <th>退货人</th>
                        <th>联系方式</th>
                        <th>创建时间</th>
                        <th>是否导出</th>
                        <th style="width: 190px;">操作</th>
                    </tr>
                </thead>
                <tbody>
                <notempty name="rejectOrders">
                    <volist name="rejectOrders" id="vo">
                        <tr  valign="top">
                            <td><input class="ids" type="checkbox" name="id[]" value="{$vo.orderid}" /></td>
                            <td>{$vo.tdorderid}</td>
                            <td>
                                <a href="{:U('Order/Orderdetails')}&orderid={$vo['oldorderid']}" style="text-decoration: none;">{$vo.oldorderid}</a>
                            </td>
                            <td><span style="color: red;font-weight: bold;">{$vo.tdtotalprice|number_format=###,2}</span> </td>
                            <td><span style="">{$vo.toName}</span> </td>
                            <td><span style="">{$vo.toPhone}</span> </td>
                            <td>{$vo.createtime|time_format} </td>
                            <td>
                                <if condition="$vo.is_export == 0">未导出<i class="glyphicon glyphicon-export">
                                </i>
                                    <else/>已导出</if>
                            </td>
                            <td>
                                <a href="{:U('Reject/detail')}&orderid={$vo['tdorderid']}" class="btn btn-default">明细</a>
                                <!--<a href="{:U('Reject/editReject')}&orderid={$vo['tdorderid']}" class="btn btn-default">编辑</a>-->
                                <a href="{:U('Reject/ajaxRejectDel?tdorderid='.$vo['tdorderid'])}" class="confirm ajax-get btn btn-warning">删除</a>
                            </td>
                        </tr>
                    </volist>
                    <else/>
                    <td colspan="12" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
            </table>
        </div>
        <div class="page">
            {$_page}
        </div>
    </form>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');

            var query = $('.search-form').find('input').serialize();
            var queryselect = $('.search-form').find('select').serialize();

            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            queryselect = queryselect.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            queryselect = queryselect.replace(/^&/g, '');

            if (url.indexOf('?') > 0) {
                url += '&' + query;
                url += '&' + queryselect;
            } else {
                url += '?' + query;
                url += '?' + queryselect;
            }

            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        highlight_subnav('{:U('Reject/rejectOrders')}');

            $('.time').datetimepicker({
                //format: 'yyyy-mm-dd hh:ii',
                format: 'yyyy-mm-dd hh:ii:ss',
                language: "zh-CN",
                minView: 2,
                autoclose: true
            });

        function orderexport(){
            var r=confirm("确定是否导出!");
            if (r==true)
            {
              $('#orderlist').submit();
            }
        }
    </script>
</block>
